package xiancheng.priority;

/**
 * @author Mr.ma
 * @since 2022/11/1 15:42
 * setPriority方法
 **/
public class Test08 {
    public static void main(String[] args) {
        TestRunnable03 testRunnable03 = new TestRunnable03();
        Thread thread1 = new Thread(testRunnable03);
        Thread thread2 = new Thread(testRunnable03);
        Thread thread3 = new Thread(testRunnable03);
        thread1.setPriority(1);
        thread2.setPriority(4);
        thread3.setPriority(10);
        thread1.setName("优先级1");
        thread2.setName("优先级4");
        thread3.setName("优先级10");
        thread1.start();
        thread2.start();
        thread3.start();
        for (int i = 0; i < 3; i++) {
            System.out.println("main ====" + i);
        }
    }
}
class TestRunnable03 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 3; i++) {
            System.out.println(Thread.currentThread().getName() + " ==== " + i);
        }
    }
}
